<?php

/**
 * @name: HOTN Scroller
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnscroller/
 */

if (!defined('e107_INIT')) { exit; }

$sql = new db;
global $footer_js, $tp;

include(e_PLUGIN."hotn_scroller/languages/".e_LANGUAGE.".php");
include(e_PLUGIN."hotn_scroller/class/scroller_options.php");
$footer_js[] = e_PLUGIN_ABS."hotn_scroller/class/script.js";

$text = "
<div id='marqueecontainer' style='position: relative; height: 460px; overflow: hidden; padding: 0pt;' onMouseover='copyspeed=pausespeed' onMouseout='copyspeed=marqueespeed'>
<div id='vmarquee' style='position: absolute; width: 98%;'>
";

$sql->db_Select("hotn_scroller_ittems","*","ORDER BY ittems_order ASC","non-default");
while($row = $sql->db_Fetch())
{
	$text .= "<div class='hotn_scroller' style='padding-bottom: 10px;'>";
	if ($row['ittems_title'] <> "") $text .= "<div class='hotn_scroller_title' style='text-align: center; font-size:14pt; font-wight:bold;'>".$row['ittems_title']."</div>";
	if ($row['ittems_text'] <> "") $text .= "<div class='hotn_scroller_text' style='padding:5px;'>".$tp->toHTML($row['ittems_text'])."</div>";
	if ($row['ittems_image'] <> "") $text .= "<div class='hotn_scroller_image' style='text-align: center;'><img src='".e_PLUGIN."hotn_scroller/images/".$row['ittems_image']."' /></div>";
	if ($row['ittems_link'] <> "") 
	{
		if ($row['ittems_link_type'] <> "") $row['ittems_link_type'] = "target='".$row['ittems_link_type']."'";
		$text .= "<div class='hotn_scroller_link' style='text-align: right;'><a href='".$row['ittems_link']."' ".$row['ittems_link_type']."'>".HOTN_SCROLLER_MENU_MORE."</a></div>";
	}
	$text .= "</div>";
}

$text .= "</div></div>";

$ns->tablerender($HOTN_SCROLLER_OPTIONS['caption'], $text, 'hotn_scrollmenu');
?>